/**
 * Created by Administrator on 2017/7/3.
 */
var vm=avalon.define({
    $id:'solution',
    solutionData:[],
    solutionBig:[],
    solutionList:[],
    columnId:[],
    goDetail:function (index) {
        window.location.href="./solutionDetail.html?id="+this.solutionList[index].number
    },
    goDetailBig:function () {
        window.location.href="./solutionDetail.html?id="+this.solutionBig[0].number
    }
})
init()
function init() {
    var columnIdArr = get_Storage("serviceColumnId");
    console.log(columnIdArr);
    var currentId = '';
    for(var i=0,len=columnIdArr.length;i<len;i++){
        if(columnIdArr[i].name=="解决方案"){
            currentId = columnIdArr[i].id;
        }
    }
    getSolutionNumber(currentId)
}

function getSolutionNumber(id) {
    var _basePath = getChildUrl(id);
    console.log("getColumnData _basePath=" + _basePath);
    $.frontEngineAjax.ajaxRequest(function (data) {
        vm.solutionBig = data.slice(1);
        vm.solutionList = data.slice(1).slice(1);
        console.log("getSolutionData=="+vm.solutionBig)
        for(var i=0,len=data.length;i<len;i++){
            vm.columnId.push(data[i].number);
        }
        /*vm.solutionData = data;*/
        console.log("getSolutionData=="+vm.columnId[0])
        getSolutionData(vm.columnId[0]);
    }, _basePath);
}

function getSolutionData(id) {//获取解决方案的数据 后台默认放第一个
    var _basePath = getDataUrl(id);
    console.log("getColumnData _basePath=" + _basePath);
    $.frontEngineAjax.ajaxRequest(function (data) {
        vm.solutionData = data;
    }, _basePath);
}